////////////////////
// Power
////////////////////
/**
 * Use the `Browser.power` API to override the system's power management features.
 *
 * Permissions: "power"
 */
export namespace power {
    export enum Level {
        /** Prevents the display from being turned off or dimmed, or the system from sleeping in response to user inactivity */
        DISPLAY = "display",
        /** Prevents the system from sleeping in response to user inactivity. */
        SYSTEM = "system",
    }

    /** Requests that power management be temporarily disabled. `level` describes the degree to which power management should be disabled. If a request previously made by the same app is still active, it will be replaced by the new request. */
    export function requestKeepAwake(level: `${Level}`): void {
        Wab.callFunction({ funcName: 'power.requestKeepAwake', level })
    }

    /** Releases a request previously made via requestKeepAwake(). */
    export function releaseKeepAwake(): void {
        Wab.callFunction({ funcName: 'power.releaseKeepAwake' })
    }

    /**
     * Reports a user activity in order to awake the screen from a dimmed or turned off state or from a screensaver. Exits the screensaver if it is currently active.
     * Can return its result via Promise in Manifest V3 or later.
     * @platform ChromeOS only
     * @since Chrome 113
     */
    export function reportActivity(callback: () => void): Promise<void> {
        return Wab.callFunctionAsync({ funcName: 'power.reportActivity' }).then(callback)
    }
}